package com.neu.wangweili.servlet;

import com.neu.wangweili.service.W_StuService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "W_UpdateStuServlet", urlPatterns = {"/W_UpdateStuServlet"})
public class W_UpdateStuServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        Map<String,String[]>map=request.getParameterMap();
        W_StuService WStuService =new W_StuService();
        int row= WStuService.updateStu(map);
        if(row>0){
            request.getRequestDispatcher("commons/success.jsp").forward(request,response);
        }else{
            request.getRequestDispatcher("commons/fail.jsp").forward(request,response);
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
